How to get inlinks object details (such as object Text)using LinkRef.

LinkRef l
Object obj
ModName_ mnSrc
int nAbs
Module mSrc
Object oSrc
Module m = current
for obj in m do
{
for l in obj <-"*" do
{
    nAbs = sourceAbsNo(l)           // Gets the source object absolute number
    mnSrc = source(l)               // Gets the source module name
    mSrc = load(moduleVersion(mnSrc), false) // Loads the source module
    oSrc = object(nAbs, mSrc)    // Reads the source object
    print nAbs
    print oSrc."Object Text" // not working
}
}


Suhas_C - Tue Jun 20 02:16:38 EDT 2017

Re: How to get inlinks object details (such as object Text)using LinkRef.
pommCannelle - Tue Jun 20 04:54:29 EDT 2017

(  just cast your printed data in string ...
-> print oSrc."Object Text" ""  

deal with link failures ... and use buffers to avoid memory leaks ... 

DB logBox = null
DBE logTextDbe = null
Buffer logBuf = null

// combine prenant en compte la gestion de la mémoire
void combine ( Buffer b, string s ) {
    Buffer tmp = create
    tmp = s; combine ( b, tmp, 0 )
    delete tmp
}

// log permettant de se passer du print
void log(string m) {
        if (null logBuf) logBuf = create()
        combine(logBuf, m)
        if (null logBox) {
                logBox = create("Log", styleCentered|styleFloating)
                logTextDbe = text(logBox,"", "", 400, 200, true)
                logTextDbe->"top"->"form"
                logTextDbe->"right"->"form"
                logTextDbe->"left"->"form"
                logTextDbe->"bottom"->"form"
                void close_log_(DB d) {
                        if ( !null logBox) { delete(logBuf) }
                        logBox = null
                        logTextDbe = null
                        hide d; destroy d
                }
                void clear_log_(DB d) {
                        setempty logBuf
                        set(logTextDbe,logBuf)
                }
                close(logBox,true,close_log_)
                apply(logBox,"Clear",clear_log_)
                realize logBox
        }
        set(logTextDbe,logBuf)
}

LinkRef l
Object obj,oSrc 
ModName_ mnSrc
int nAbs
Module mSrc
Module m = current
Buffer report = create()

for obj in m do {
    for l in obj <-"*" do {
        nAbs = sourceAbsNo(l)           // Gets the source object absolute number
        mnSrc = source(l)               // Gets the source module name
        mSrc = load(moduleVersion(mnSrc), false) // Loads the source module
        oSrc = object(nAbs, mSrc)       // Reads the source object
        if (null oSrc) { // deal with errors ... 
            combine( report, "CORREPONDANCE IS MISSING - Object " nAbs " - module " name(mSrc) "\n" )
            continue 
        }
        combine( report, nAbs " - ")
        combine( report, oSrc."Object Text" "\n") // working now ;)
    }
}

log tempStringOf report
delete report

 


Have fun ! )